package com.myjpa.controller;


import com.myjpa.common.criteria.JacksonCriteria;
import com.myjpa.common.web.MapResponse;
import com.myjpa.common.web.PagedResponse;
import com.myjpa.entity.Order;
import com.myjpa.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: yaoll
 * @date: 2020-09-04
 * @verison: 1.0
 */
@RestController
@RequestMapping("/order")
public class OrderController {

	@Autowired
	private OrderService service;

	@PostMapping("/query")
	public PagedResponse<Order> query(@RequestBody JacksonCriteria criteria) {
		return service.query(criteria);
	}

	@PostMapping("/create")
	public MapResponse create(@RequestBody Order order) {
		return service.create(order);
	}

	@PostMapping("/update")
	public MapResponse update(@RequestBody Order order) {
		return service.update(order);
	}

	@PostMapping("/delete")
	public MapResponse delete(@RequestBody Order order) {
		return service.delete(order);
	}

}
